﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Add.aspx.cs" Inherits="CRM.Web.Admin.Page.UserInfo.Add" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script src="/Content/jquery/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="/Content/jquery/pager/pager.js" type="text/javascript"></script>
    <link href="/Content/jquery/validation/validation.css" rel="stylesheet" type="text/css" />
    <script src="/Content/jquery/validation/validation.js" type="text/javascript"></script>
    <script src="/Content/jquery/artDialog/jquery.artDialog.source.js?skin=default" type="text/javascript"></script>
    <script src="/Content/jquery/artDialog/plugins/iframeTools.source.js?skin=default"
        type="text/javascript"></script>
    <script src="/Content/jquery/loading/loading.js" type="text/javascript"></script>
    <script src="/Content/jquery/json2.js" type="text/javascript"></script>
    <script src="/Content/jquery/query_url.js" type="text/javascript"></script>
    <script src="/Content/jquery/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Content/jquery/kindeditor/kindeditor.js" type="text/javascript"></script>
    <script src="/Content/jquery/uploadify/jquery.uploadify.v2.1.4.js" type="text/javascript"></script>
    <script src="/Content/jquery/uploadify/swfobject.js" type="text/javascript"></script>
    <script type="text/javascript">

        //编辑器初始化
        var editor;

        $(document).ready(function () {
            //管理员
            $('#UserName').blur(function () {
                ValidationInput($(this),
{ s: '', e: '必填项', showSuccess: false },
{ min: 1, max: 20, e: '长度在1-20的指定范围', s: '', showSuccess: true },
undefined
);
            }).focus(function () {
                ClearErrorMessage($(this));
            });
            //管理员类型
            $('#UserType').blur(function () {
                ValidationInput($(this),
undefined,
undefined,
undefined
);
            }).focus(function () {
                ClearErrorMessage($(this));
            });
            $('#sel_UserType').change(function () {
                $('#UserType').val($(this).val());
            });
            //密码
            $('#Password').blur(function () {
                ValidationInput($(this),
undefined,
undefined,
undefined
);
            }).focus(function () {
                ClearErrorMessage($(this));
            });
//            $('#sel_Password').change(function () {
//                $('#Password').val($(this).val());
//            });

        });

        var _cnblogs_yixian_add = {

            //单一实体
            _single: {},

            //临时变量
            _temp: "",

            //提交表单
            _submitFunc: function () {
                var load = "";
                var isSuccess = true;

                //需要验证的数组
                var validationArray = [
                  { UserName: "" },
                                  { UserType: "" },
                                  { Password: "" }
                ];

                //可空判断
                var result = SubmitForm(validationArray, true);

                //判断是否验证通过
                if (!result)
                    return isSuccess = false;

                //给实体赋值
                _cnblogs_yixian_add._single.UserName = $.trim($("#UserName").val());
                _cnblogs_yixian_add._single.UserType = $.trim($("#UserType").val());
                _cnblogs_yixian_add._single.Password = $.trim($("#Password").val());

                $.ajax({
                    type: "post",
                    data: {
                        action: "AddFunc",
                        json: JSON.stringify(_cnblogs_yixian_add._single)
                    },
                    url: "/Ajax/UserInfoAjax.ashx",
                    async: false,
                    beforeSend: function () {
                    },
                    success: function (data) {
                        if (data == "True") {
                            isSuccess = true;
                        } else {
                            isSuccess = false;
                        }
                    },
                    error: function () {
                        isSuccess = false;
                    }
                });
                return isSuccess;
            }
        };

    </script>
</head>
<body style="text-align: left; font-size: 8px">
    <table>
        <tr>
            <td>
                管理员类型:
            </td>
            <td>
                <select id='sel_UserType'>
                    <option value=''>-- 请选择 --</option>
                    <option value='1'>超级管理员</option>
                    <option value='2'>管理员</option>
                </select>
                <input type='text' id='UserType' style='visibility: collapse; width: 1px; height: 1px;
                    border: 0px; padding: 0px; margin: 0px' />
            </td>
        </tr>
        <tr>
            <td>
                管理员:
            </td>
            <td>
                <input type='text' id='UserName' />
            </td>
        </tr>
        <tr>
            <td>
                密码:
            </td>
            <td>               
                <input type="password" id='Password' />
            </td>
        </tr>
    </table>
</body>
</html>
